function [alpha,beta,psi,mu,phi,sigmaxtil] = setQTSMparameters(theta1,setup)
% xtil_t = [m_t n_t omegaInfl_t omegaY_t]'

nm    = setup.nm;  %number of macro variables
nn    = setup.nn;  %number of latent variables
nxtil = 2*nm + nn;

alpha = theta1.alpha;
beta  = zeros(nxtil,1);
for i=1:2*nm+nn
    name = ['beta',num2str(i)];
    beta(i,1) = theta1.(name);
end
psi   = zeros(nxtil,nxtil);
for i=1:nm
    psi(i,nm+i) = 0.5;
    psi(nm+i,i) = 0.5;
end

phi = zeros(nxtil,nxtil);
for i=1:2*nm+nn
   for j=1:2*nm+nn
        name = ['phi',num2str(i),num2str(j)];
        phi(i,j) = theta1.(name);
   end
end
h0Q = zeros(nxtil,1);
for i=1:2*nm+nn
    name = ['h0Q',num2str(i)];
    h0Q(i,1) = theta1.(name);
end
mu = phi\h0Q;
sigmaxtil = zeros(nxtil,nxtil);
for i=1:2*nm+nn
   for j=1:i
        name = ['sigma',num2str(i),num2str(j)];
        sigmaxtil(i,j) = theta1.(name);
   end
end

% test
%syms m1_t m2_t n_t omegaInfl_t omegaY_t
%syms mu1 mu2 mu3 mu4 mu5;
% %xtil_t = [m1_t m2_t n_t omegaInfl_t omegaY_t].';
%% %mu     = [mu1 mu2 mu3 mu4 mu5].'
%xtil_t = [m1_t m2_t  omegaInfl_t omegaY_t].';
%mu     = [mu1 mu2 mu3 mu4 ].'
%2*mu.'*psi*xtil_t
%xtil_t.'*psi*xtil_t
